<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    request.setAttribute("basePath",basePath);
%>
<!DOCTYPE>
<html>
<head>
    <title>设备管理</title>
    <%@ include file="/resources/js/easyui/taglibs.jsp"%>
    <%@ include file="/resources/js/easyui/_easyui.jsp"%>
    <%@ include file="/resources/js/easyui/_message.jsp"%>
    <%@ include file="/resources/js/easyui/_viewJS.jsp"%>
</head>

<body>

<div id="tb" style="padding:5px;height:auto;">
    <table>
        <tr>
            <td><label style="margin-left:5px">设备码:</label></td>
            <td>
                <input style="width:150px" id="code" class="easyui-textbox" />
            </td>

            <td>
                <a href="javascript:;" style="margin-left: 10px;vertical-align:middle" class="easyui-linkbutton" iconCls="icon-search" id="queryDataBtn">查询</a>
            </td>
        </tr>
    </table>
</div>

<table id="dg"
       title="设备管理"
       fitColumns="true"
       singleSelect="true"
       data-options="
       pageSize:10,
       toolbar:'#tb',
       pagination:true,
       collapsible:true,
       url:'${basePath}web/device/list.json',
       method:'GET'">
    <thead>

    <tr>
        <th data-options="field:'deviceid',checkbox:true,width:10" ></th>
        <th data-options="field:'devicename' ,width:150" align="center">设备名称</th>
        <th data-options="field:'did' ,width:100" align="center" >设备简码</th>
        <th data-options="field:'mac' ,width:100" align="center" >MAC地址</th>
        <th data-options="field:'state' ,width:100" align="center" >状态</th>
        <th data-options="field:'isonline' ,width:100" align="center" >在线状态</th>
        <th data-options="field:'dp' ,width:100" align="center" >信号强度</th>
        <th data-options="field:'lastonlinetime' ,width:100" align="center" >最后在线时间</th>
        <th data-options="field:'bindtime' ,width:100" align="center" >绑定时间</th>
        <th data-options="field:'warntime' ,width:100" align="center" >报警时间</th>
        <th data-options="field:'addgift' ,width:100" align="center" >累计增加礼品数</th>
        <th data-options="field:'outgift' ,width:100" align="center" >累计增出礼品数</th>
        <th data-options="field:'money' ,width:100" align="center" >金额</th>
        <th data-options="field:'netmoney' ,width:100" align="center" >第三方支付金额</th>
        <th data-options="field:'coin' ,width:100" align="center" >设备余币</th>
        <th data-options="field:'batterystatus' ,width:100" align="center" >电池状态</th>
        <th data-options="field:'skey' ,width:100" align="center" >加密</th>
    </tr>

    </thead>
</table>

<!-- 添加窗体s -->
<div id="addWin"
     class="easyui-window"
     minimizable="false"
     collapsible="false"
     title="明细窗口"
     data-options="closed:true,modal:true,top:20"
     style="width:600px;height:400px;">
    <div id="addWinDetailTable" class="easyui-layout" data-options="fit:true">
        <div data-options="region:'center',border:false"></div>
        <div data-options="region:'south',border:false" style="text-align:center;padding:5px 5px 5px 0;background-color: #F5F5F5;border-top: solid 1px #E6E6E6;">
            <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" id="addSubBtn">提交</a>
            <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" id="closeAddWinBtn">关闭</a>
        </div>
    </div>
</div>
<!-- 添加窗体e -->

<!-- 修改窗体s -->
<div id="editWin"
     class="easyui-window"
     minimizable="false"
     collapsible="false"
     title="明细窗口"
     data-options="closed:true,modal:true,top:20"
     style="width:600px;height:400px;">
    <div id="editWinDetailTable" class="easyui-layout" data-options="fit:true">
        <div data-options="region:'center',border:false"></div>
        <div data-options="region:'south',border:false" style="text-align:center;padding:5px 5px 5px 0;background-color: #F5F5F5;border-top: solid 1px #E6E6E6;">
            <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" id="editSubBtn">提交</a>
            <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" id="closeEditWinBtn">关闭</a>
        </div>
    </div>
</div>
<!-- 修改窗体e -->

</body>

<script type="text/javascript">
    function View(){
        var that = this;

        that.events = [
            { sel : '#queryDataBtn', act : 'click', func : 'queryData' }
        ];

        that.$dataGrid = $('#dg');

        that.dataGridOption = {
            queryParams : {
                code : function(){return $('#code').val();}
            }
        };

        $.extend(that.dataGridOption, ViewHelper.template.gridOption);

        that.$dataGrid.datagrid(that.dataGridOption);

        that.queryData = function () {
            that.$dataGrid.datagrid(that.dataGridOption);
        };

        EventHandler.call(that, that.events);

        return that;
    }

    var view;

    $(function(){
        inherit(View, EventHandler);
        view = new View();
    });

</script>

</html>